import axios from "axios"

const baseURL = 'https://pcapi-xiaotuxian-front-devtest.itheima.net/'

const request = axios.create({
  baseURL,
  timeout: 10000
})

request.interceptors.request.use(function (config) {
  return config
}, function (error) {
  return Promise.reject(error)
})

request.interceptors.response.use(response => {
  return response.data.result
}, err => {

  return Promise.reject(err)
})

export default request